_n The number of scaling function samples in points.
_p_o_i_n_t_s An array of scaling function samples, each of which is an (_L_O_D,
_f_u_n_c_t_i_o_n-_v_a_l_u_e) pair.
DDDDEEEESSSSCCCCRRRRIIIIPPPPTTTTIIIIOOOONNNN
The detail texture extension defines three additional texture
magnification filters. These filters are selected by choosing one of the
values GGGGLLLL____LLLLIIIINNNNEEEEAAAARRRR____DDDDEEEETTTTAAAAIIIILLLL____SSSSGGGGIIIISSSS, GGGGLLLL____LLLLIIIINNNNEEEEAAAARRRR____DDDDEEEETTTTAAAAIIIILLLL____AAAALLLLPPPPHHHHAAAA____SSSSGGGGIIIISSSS, or
GGGGLLLL____LLLLIIIINNNNEEEEAAAARRRR____DDDDEEEETTTTAAAAIIIILLLL____CCCCOOOOLLLLOOOORRRR____SSSSGGGGIIIISSSS for the current 2D texture's
All three filters sample the level zero texture array exactly as it would
be sampled with filter mode GGGGLLLL____LLLLIIIINNNNEEEEAAAARRRR. All three also sample the level
zero texture array of a second texture, known as the detail texture, when
two conditions are met. The detail texture corresponding to texture
GGGGLLLL____TTTTEEEEXXXXTTTTUUUURRRREEEE____2222DDDD is GGGGLLLL____DDDDEEEETTTTAAAAIIIILLLL____TTTTEEEEXXXXTTTTUUUURRRREEEE____2222DDDD____SSSSGGGGIIIISSSS. The conditions are:
1. The active texture must be GGGGLLLL____TTTTEEEEXXXXTTTTUUUURRRREEEE____2222DDDD.
2. The internal formats of GGGGLLLL____TTTTEEEEXXXXTTTTUUUURRRREEEE____2222DDDD and
GGGGLLLL____DDDDEEEETTTTAAAAIIIILLLL____TTTTEEEEXXXXTTTTUUUURRRREEEE____2222DDDD____SSSSGGGGIIIISSSS must have been specified identically.
3 The level 0 image of GGGGLLLL____TTTTEEEEXXXXTTTTUUUURRRREEEE____2222DDDD must have nonzero width and
height.
If these conditions are not met, it is as though the magnification
texture filter was GGGGLLLL____LLLLIIIINNNNEEEEAAAARRRR. (Although querying the magnification
filter value will return the value as specified.) If they are met, the
level zero array of the detail texture is also linearly sampled, using
the following arithmetic:
n = log base 2 of the width of the level zero array of GGGGLLLL____TTTTEEEEXXXXTTTTUUUURRRREEEE____2222DDDD
m = log base 2 of the height of the level zero array of GGGGLLLL____TTTTEEEEXXXXTTTTUUUURRRREEEE____2222DDDD
N = log base 2 of the width of GGGGLLLL____DDDDEEEETTTTAAAAIIIILLLL____TTTTEEEEXXXXTTTTUUUURRRREEEE____2222DDDD____SSSSGGGGIIIISSSS
M = log base 2 of the height of GGGGLLLL____DDDDEEEETTTTAAAAIIIILLLL____TTTTEEEEXXXXTTTTUUUURRRREEEE____2222DDDD____SSSSGGGGIIIISSSS
L = GGGGLLLL____DDDDEEEETTTTAAAAIIIILLLL____TTTTEEEEXXXXTTTTUUUURRRREEEE____LLLLEEEEVVVVEEEELLLL____SSSSGGGGIIIISSSS value of GGGGLLLL____TTTTEEEEXXXXTTTTUUUURRRREEEE____2222DDDD
Thus _L, the value of the GGGGLLLL____DDDDEEEETTTTAAAAIIIILLLL____TTTTEEEEXXXXTTTTUUUURRRREEEE____LLLLEEEEVVVVEEEELLLL____SSSSGGGGIIIISSSS parameter of
GGGGLLLL____TTTTEEEEXXXXTTTTUUUURRRREEEE____2222DDDD, can be thought of as the number of levels that separate
the layer zero image of GGGGLLLL____TTTTEEEEXXXXTTTTUUUURRRREEEE____2222DDDD and the image of
GGGGLLLL____DDDDEEEETTTTAAAAIIIILLLL____TTTTEEEEXXXXTTTTUUUURRRREEEE____2222DDDD____SSSSGGGGIIIISSSS, which is replicated as necessary to fill the
appropriate number of texels. For example, if _L is 2, the detail texture
image is replicated as necessary in x and y to form a single image whose
dimensions are four times larger than the level zero array of
The texture value computed from the primary texture (_T_t_e_x_t_u_r_e) and the
value computed from the detail texture (_T_d_e_t_a_i_l) are combined in one of
two ways to compute the final texture value (_T). The values of _T_t_e_x_t_u_r_e,
_T_d_e_t_a_i_l, and _T are treated as though they range from 0.0 through 1.0 in
these equations.
If GGGGLLLL____DDDDEEEETTTTAAAAIIIILLLL____TTTTEEEEXXXXTTTTUUUURRRREEEE____MMMMOOOODDDDEEEE____SSSSGGGGIIIISSSS of GGGGLLLL____TTTTEEEEXXXXTTTTUUUURRRREEEE____2222DDDD is GGGGLLLL____AAAADDDDDDDD, then
T' = Ttexture + F(LOD) * (2*Tdetail-1)
T = 0 if T' < 0;
T' if 0 <= T' <= 1;
1 if T' > 1.
where _F is a function of the level-of-detail parameter _L_O_D. In effect,
the detail texture is scaled and biased so that its range is [-1,1]. The
resulting signed value is scaled by a function of _L_O_D, added to the base
texture, and clamped to [0,1].
If GGGGLLLL____DDDDEEEETTTTAAAAIIIILLLL____TTTTEEEEXXXXTTTTUUUURRRREEEE____MMMMOOOODDDDEEEE____SSSSGGGGIIIISSSS of GGGGLLLL____TTTTEEEEXXXXTTTTUUUURRRREEEE____2222DDDD is GGGGLLLL____MMMMOOOODDDDUUUULLLLAAAATTTTEEEE, then
Here again the detail texture is scaled and biased so that its range is
[-1,1]. The resulting signed value is scaled by a function of _L_O_D and
biased by 1. This result scales the base texture, which is then clamped
to [0,1].
ggggllllDDDDeeeettttaaaaiiiillllTTTTeeeexxxxFFFFuuuunnnnccccSSSSGGGGIIIISSSS is used to specify the scaling function _F. _t_a_r_g_e_t
must be GGGGLLLL____TTTTEEEEXXXXTTTTUUUURRRREEEE____2222DDDD. _n specifies the number of pairs of values in
_p_o_i_n_t_s. _p_o_i_n_t_s points to an array of pairs of floating point values.
The first value of each pair specifies a value of _L_O_D, and the second
value of each pair specifies the corresponding function value. The order
in which the points are specified is not significant. The _n value pairs
in _p_o_i_n_t_s completely specify the function, replacing any previous specif-
ication that may have existed.
The function _F is evaluated by fitting a curve through the sample points
specified in _p_o_i_n_t_s. This curve may be linear between adjacent points,
or it may be smoothed, but it will pass exactly through the points, lim-
ited only by the resolution of the implementation. The value pair with
the lowest _L_O_D value specifies the function value _F for all values of _L_O_D
less than or equal to that pair's _L_O_D. Likewise, the value pair with the
greatest _L_O_D value specifies the function value _F for all values of _L_O_D
greater than or equal to that pair's _L_O_D.
Note that negative values of LOD correspond to magnification, and posi-
tive values correspond to minification. Hence, an LOD of -4 corresponds
to a magnification by a factor of 2**4, or 16. The default function
points are (0,0) and (-4,1).
If the texture magnification filter is GGGGLLLL____LLLLIIIINNNNEEEEAAAARRRR____DDDDEEEETTTTAAAAIIIILLLL____SSSSGGGGIIIISSSS, then both
the color and the alpha components of _T are computed as described in the
equations above. If the filter is GGGGLLLL____LLLLIIIINNNNEEEEAAAARRRR____DDDDEEEETTTTAAAAIIIILLLL____CCCCOOOOLLLLOOOORRRR____SSSSGGGGIIIISSSS, then all
components of _T other than alpha are computed as described above, and the
alpha component of _T is computed as if the texture magnification filter
were GGGGLLLL____LLLLIIIINNNNEEEEAAAARRRR. Finally, if the filter is GGGGLLLL____LLLLIIIINNNNEEEEAAAARRRR____DDDDEEEETTTTAAAAIIIILLLL____AAAALLLLPPPPHHHHAAAA____SSSSGGGGIIIISSSS,
the alpha component of _T is computed as described in the equations above,
and all other components of _T are computed as if the texture magnifica-
tion filter were GGGGLLLL____LLLLIIIINNNNEEEEAAAARRRR.
NNNNOOOOTTTTEEEESSSS
The detail texture itself is specified by calling ggggllllTTTTeeeexxxxIIIImmmmaaaaggggeeee2222DDDD with tar-
get set to GGGGLLLL____DDDDEEEETTTTAAAAIIIILLLL____TTTTEEEEXXXXTTTTUUUURRRREEEE____2222DDDD____SSSSGGGGIIIISSSS, level set to 0, border set to 0,
and the other parameters specified to generate the desired image.
EEEERRRRRRRROOOORRRRSSSS
GGGGLLLL____IIIINNNNVVVVAAAALLLLIIIIDDDD____EEEENNNNUUUUMMMM is generated if _t_a_r_g_e_t is not GGGGLLLL____TTTTEEEEXXXXTTTTUUUURRRREEEE____2222DDDD.
GGGGLLLL____IIIINNNNVVVVAAAALLLLIIIIDDDD____VVVVAAAALLLLUUUUEEEE is generated if _n is negative.
GGGGLLLL____IIIINNNNVVVVAAAALLLLIIIIDDDD____OOOOPPPPEEEERRRRAAAATTTTIIIIOOOONNNN is generated if ggggllllDDDDeeeettttaaaaiiiillllTTTTeeeexxxxFFFFuuuunnnnccccSSSSGGGGIIIISSSS is executed
between the execution of ggggllllBBBBeeeeggggiiiinnnn and the corresponding execution of